home *** CD-ROM | disk | FTP | other *** search
- <refentry id="libgimp-gimpunit" revision="19 Jan 2001">
- <refmeta>
- <refentrytitle>gimpunit</refentrytitle>
- <manvolnum>3</manvolnum>
- <refmiscinfo>LIBGIMP Library</refmiscinfo>
- </refmeta>
-
- <refnamediv>
- <refname>gimpunit</refname><refpurpose>Provides a collection of predefined units and functions for creating
- user-defined units.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv><title>Synopsis</title>
- <synopsis>
-
-
-
- enum <link linkend="GimpUnit">GimpUnit</link>;
- <link linkend="gint">gint</link> <link linkend="gimp-unit-get-number-of-units">gimp_unit_get_number_of_units</link> (void);
- <link linkend="gint">gint</link> <link linkend="gimp-unit-get-number-of-built-in-units">gimp_unit_get_number_of_built_in_units</link>
- (void);
- <link linkend="GimpUnit">GimpUnit</link> <link linkend="gimp-unit-new">gimp_unit_new</link> (<link linkend="gchar">gchar</link> *identifier,
- <link linkend="gdouble">gdouble</link> factor,
- <link linkend="gint">gint</link> digits,
- <link linkend="gchar">gchar</link> *symbol,
- <link linkend="gchar">gchar</link> *abbreviation,
- <link linkend="gchar">gchar</link> *singular,
- <link linkend="gchar">gchar</link> *plural);
- <link linkend="gboolean">gboolean</link> <link linkend="gimp-unit-get-deletion-flag">gimp_unit_get_deletion_flag</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- void <link linkend="gimp-unit-set-deletion-flag">gimp_unit_set_deletion_flag</link> (<link linkend="GimpUnit">GimpUnit</link> unit,
- <link linkend="gboolean">gboolean</link> deletion_flag);
- <link linkend="gdouble">gdouble</link> <link linkend="gimp-unit-get-factor">gimp_unit_get_factor</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gint">gint</link> <link linkend="gimp-unit-get-digits">gimp_unit_get_digits</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gchar">gchar</link>* <link linkend="gimp-unit-get-identifier">gimp_unit_get_identifier</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gchar">gchar</link>* <link linkend="gimp-unit-get-symbol">gimp_unit_get_symbol</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gchar">gchar</link>* <link linkend="gimp-unit-get-abbreviation">gimp_unit_get_abbreviation</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gchar">gchar</link>* <link linkend="gimp-unit-get-singular">gimp_unit_get_singular</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="gchar">gchar</link>* <link linkend="gimp-unit-get-plural">gimp_unit_get_plural</link> (<link linkend="GimpUnit">GimpUnit</link> unit);
- </synopsis>
- </refsynopsisdiv>
-
-
-
-
-
- <refsect1>
- <title>Description</title>
- <para>
- Provides a collection of predefined units and functions for creating
- user-defined units.
-
- </para>
- </refsect1>
-
- <refsect1>
- <title>Details</title>
- <refsect2>
- <title><anchor id="GimpUnit">enum GimpUnit</title>
- <programlisting>typedef enum
- {
- GIMP_UNIT_PIXEL = 0,
-
- GIMP_UNIT_INCH = 1,
- GIMP_UNIT_MM = 2,
- GIMP_UNIT_POINT = 3,
- GIMP_UNIT_PICA = 4,
-
- GIMP_UNIT_END = 5,
-
- GIMP_UNIT_PERCENT = 65536
- } GimpUnit;
- </programlisting>
- <para>
-
- </para></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-number-of-units">gimp_unit_get_number_of_units ()</title>
- <programlisting><link linkend="gint">gint</link> gimp_unit_get_number_of_units (void);</programlisting>
- <para>
- Returns the number of units which are known to the <link linkend="GimpUnit">GimpUnit</link> system.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The number of defined units.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-number-of-built-in-units">gimp_unit_get_number_of_built_in_units ()</title>
- <programlisting><link linkend="gint">gint</link> gimp_unit_get_number_of_built_in_units
- (void);</programlisting>
- <para>
- Returns the number of <link linkend="GimpUnit">GimpUnit</link>'s which are hardcoded in the unit system
- (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit"
- UNIT_PIXEL).</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The number of built-in units.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-new">gimp_unit_new ()</title>
- <programlisting><link linkend="GimpUnit">GimpUnit</link> gimp_unit_new (<link linkend="gchar">gchar</link> *identifier,
- <link linkend="gdouble">gdouble</link> factor,
- <link linkend="gint">gint</link> digits,
- <link linkend="gchar">gchar</link> *symbol,
- <link linkend="gchar">gchar</link> *abbreviation,
- <link linkend="gchar">gchar</link> *singular,
- <link linkend="gchar">gchar</link> *plural);</programlisting>
- <para>
- Returns the integer ID of the new <link linkend="GimpUnit">GimpUnit</link>.
- </para>
- <para>
- Note that a new unit is always created with it's deletion flag
- set to <link linkend="TRUE-CAPS">TRUE</link>. You will have to set it to <link linkend="FALSE-CAPS">FALSE</link> with
- <link linkend="gimp-unit-set-deletion-flag">gimp_unit_set_deletion_flag</link>() to make the unit definition persistent.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>identifier</parameter> :</entry>
- <entry> The unit's identifier string.
- </entry></row>
- <row><entry align="right"><parameter>factor</parameter> :</entry>
- <entry> The unit's factor (how many units are in one inch).
- </entry></row>
- <row><entry align="right"><parameter>digits</parameter> :</entry>
- <entry> The unit's suggested number of digits (see <link linkend="gimp-unit-get-digits">gimp_unit_get_digits</link>()).
- </entry></row>
- <row><entry align="right"><parameter>symbol</parameter> :</entry>
- <entry> The symbol of the unit (e.g. "''" for inch).
- </entry></row>
- <row><entry align="right"><parameter>abbreviation</parameter> :</entry>
- <entry> The abbreviation of the unit.
- </entry></row>
- <row><entry align="right"><parameter>singular</parameter> :</entry>
- <entry> The singular form of the unit.
- </entry></row>
- <row><entry align="right"><parameter>plural</parameter> :</entry>
- <entry> The plural form of the unit.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The ID of the new unit.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-deletion-flag">gimp_unit_get_deletion_flag ()</title>
- <programlisting><link linkend="gboolean">gboolean</link> gimp_unit_get_deletion_flag (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- </para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the <parameter>deletion_flag</parameter> of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's <parameter>deletion_flag</parameter>.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-set-deletion-flag">gimp_unit_set_deletion_flag ()</title>
- <programlisting>void gimp_unit_set_deletion_flag (<link linkend="GimpUnit">GimpUnit</link> unit,
- <link linkend="gboolean">gboolean</link> deletion_flag);</programlisting>
- <para>
- Sets a <link linkend="GimpUnit">GimpUnit</link>'s <parameter>deletion_flag</parameter>. If the <parameter>deletion_flag</parameter> of a unit is
- <link linkend="TRUE-CAPS">TRUE</link> when GIMP exits, this unit will not be saved in the uses's
- "unitrc" file.
- </para>
- <para>
- Trying to change the <parameter>deletion_flag</parameter> of a built-in unit will be silently
- ignored.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to set the <parameter>deletion_flag</parameter> for.
- </entry></row>
- <row><entry align="right"><parameter>deletion_flag</parameter> :</entry>
- <entry> The new deletion_flag.
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-factor">gimp_unit_get_factor ()</title>
- <programlisting><link linkend="gdouble">gdouble</link> gimp_unit_get_factor (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- A <link linkend="GimpUnit">GimpUnit</link>'s <parameter>factor</parameter> is defined to be:
- </para>
- <para>
- distance_in_units == (<parameter>factor</parameter> * distance_in_inches)
- </para>
- <para>
- Returns 0 for <parameter>unit</parameter> == GIMP_UNIT_PIXEL.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the factor of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's factor.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-digits">gimp_unit_get_digits ()</title>
- <programlisting><link linkend="gint">gint</link> gimp_unit_get_digits (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- Returns the number of digits an entry field should provide to get
- approximately the same accuracy as an inch input field with two digits.
- </para>
- <para>
- Returns 0 for <parameter>unit</parameter> == GIMP_UNIT_PIXEL.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the digits.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The suggested number of digits.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-identifier">gimp_unit_get_identifier ()</title>
- <programlisting><link linkend="gchar">gchar</link>* gimp_unit_get_identifier (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- This is an unstranslated string.
- </para>
- <para>
- NOTE: This string has to be <link linkend="g-free">g_free</link>()'d by plugins but is a pointer to a
- constant string when this function is used from inside the GIMP.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the identifier of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's identifier.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-symbol">gimp_unit_get_symbol ()</title>
- <programlisting><link linkend="gchar">gchar</link>* gimp_unit_get_symbol (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- This is e.g. "''" for UNIT_INCH.
- </para>
- <para>
- NOTE: This string has to be <link linkend="g-free">g_free</link>()'d by plugins but is a pointer to a
- constant string when this function is used from inside the GIMP.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the symbol of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's symbol.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-abbreviation">gimp_unit_get_abbreviation ()</title>
- <programlisting><link linkend="gchar">gchar</link>* gimp_unit_get_abbreviation (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- For built-in units, this function returns the translated abbreviation
- of the unit.
- </para>
- <para>
- NOTE: This string has to be <link linkend="g-free">g_free</link>()'d by plugins but is a pointer to a
- constant string when this function is used from inside the GIMP.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the abbreviation of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's abbreviation.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-singular">gimp_unit_get_singular ()</title>
- <programlisting><link linkend="gchar">gchar</link>* gimp_unit_get_singular (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- For built-in units, this function returns the translated singular form
- of the unit's name.
- </para>
- <para>
- NOTE: This string has to be <link linkend="g-free">g_free</link>()'d by plugins but is a pointer to a
- constant string when this function is used from inside the GIMP.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the singular form of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's singular form.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-get-plural">gimp_unit_get_plural ()</title>
- <programlisting><link linkend="gchar">gchar</link>* gimp_unit_get_plural (<link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- For built-in units, this function returns the translated plural form
- of the unit's name.
- </para>
- <para>
- NOTE: This string has to be <link linkend="g-free">g_free</link>()'d by plugins but is a pointer to a
- constant string when this function is used from inside the GIMP.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The unit you want to know the plural form of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit's plural form.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
-
- </refsect1>
-
-
-
- <refsect1>
- <title>See Also</title>
- <para>
- <link linkend="GimpUnitMenu">GimpUnitMenu</link>
- </para>
- <para>
- <link linkend="GimpSizeEntry">GimpSizeEntry</link>
- </para>
- </refsect1>
-
- </refentry>
-